package com.jn.mvvm2.repository;

import com.jn.mvvm2.entity.Idiom;
import com.jn.mvvm2.http.GlobalRetrofitClient;
import com.jn.mvvm2.service.IdiomService;

import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
import io.reactivex.rxjava3.core.Observable;
import io.reactivex.rxjava3.schedulers.Schedulers;

public class IdiomRepository {
    private IdiomService mIdiomService;

    public IdiomRepository() {
        mIdiomService = GlobalRetrofitClient.getInstance().create(IdiomService.class);
    }

    public Observable<Idiom> getData() {
        return mIdiomService.getData()
                .observeOn(AndroidSchedulers.mainThread())
                .subscribeOn(Schedulers.io());
    }
}